home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / utilities / cli / apipe-37.6.lha / APipe-37.6 / README < prev   
Encoding:
Text File  |  1994-10-21  |  5.9 KB  |  160 lines

  1. ################################################################################
  2. #
  3. #   APipe-Handler for AmigaDOS 2.04 or higher.
  4. #
  5. #   Copyright (C) 1991 by Per Bojsen.  All Rights Reserved.
  6. #
  7. #   Permission is granted to any individual or institution to use, copy,
  8. #   modify, and distribute this software, provided that this complete
  9. #   copyright and permission notice is maintained, intact, in all copies
  10. #   and supporting documentation.
  11. #
  12. #   This software is provided on an "as is" basis without express or
  13. #   implied warranty.
  14. #
  15.  
  16. NOTE: See section (5) for a description of the changes in this archive.
  17.       Recent changes are preceeded with a | character.
  18.  
  19. NOTE: See the CAVEAT section (3) for some important information on the
  20.       implementation of the APipe-Handler.
  21.  
  22. NOTE: Update information is included at the end of this file.
  23.  
  24. This archive contains the source for the APipe-Handler.  The archive should
  25. include the following files:
  26.  
  27.         child.asm
  28.         pgmpipe.c
  29.         APipe-Handler_rev.h
  30.         APipe-Handler_rev.i
  31.         APipe-Handler_rev.rev
  32.         Makefile
  33.         Mountlist
  34.         README
  35.  
  36.  
  37. 1) Introduction
  38.  
  39. Some weeks ago I got a strange idea for a new kind of pipe handler.  Let's
  40. call it `APipe-Handler' and its DOS device name `APIPE:'.  The special
  41. thing about this handler is that it interprets the name after the prefix
  42. `APIPE:' as a command line to be executed.  If the `APIPE:<command line>'
  43. file is opened as MODE_OLDFILE the standard output from the command will be
  44. available for reading; if the file is opened as MODE_NEWFILE the command will
  45. get its standard input from the data written to the file.
  46.  
  47. Here's some examples on the usage of this pipe handler:
  48.  
  49.     1> search APIPE:alias list ; print the aliases containing list
  50.  
  51.     2> sort "APIPE:list nohead" CONSOLE: ; sorted list
  52.  
  53.     3> comm -12 "APIPE:grep list APIPE:alias" "APIPE:grep nohead APIPE:alias"
  54.  
  55.     4> status >"APIPE:grep uucico" ; does not work with SAS grep: use GNU!
  56.  
  57.     5> grep uucico APIPE:status
  58.  
  59. The first two examples show things that could be done in a shell that
  60. supported anonymous pipes `|' *if* the standard AmigaDOS utilities had the
  61. ability to read from their standard input.
  62.  
  63. The third example shows something that is impossible to do with `|' command
  64. line pipes, and requires several lines (or shells) with PIPE: (comm is a
  65. program from the GNU text utilities that prints line in common between to
  66. sorted files).
  67.  
  68. Example four and five should produce equivalent results.
  69.  
  70. Other possible uses of APIPE: is as a file to save to from an editor,
  71. i.e., you could prepare some script or data file and save it directly to
  72. the command/program from your editor.  Or you could insert the output
  73. from a command into the file you're editing.  The editor you're using does
  74. not need any special support for this besides the ability to save and
  75. load files :-)
  76.  
  77. One nice thing about this handler is that it allows for a really simple
  78. implememtation of the UNIX popen()/pclose() functions: just append the
  79. command line to `APIPE:' and call fopen() on this string;  pclose() is
  80. simply a wrapper around fclose().  This was the main reason I came up with
  81. the idea, BTW.
  82.  
  83.  
  84. 2) How to build APipe-Handler
  85.  
  86. The build instructions assume you have SAS/C 5.10.
  87.  
  88. Edit the Makefile to reflect your installation.  You may choose to
  89. activate the machine architecture macros if you have a faster processor.
  90.  
  91. After you have customized the Makefile, type run your make program
  92. to build the handler.
  93.  
  94.  
  95. 3) CAVEAT
  96.  
  97. The APipe-Handler needs to copy the environment of the requester process
  98. for the child process which runs the specified command line.  The enviroment
  99. includes the path, IO, current directory, shell variables, and aliases.
  100.  
  101. Unfortunately, there's currently no way to copy this environment safely
  102. which is safe under all circumstances.  The handler may fail if the process
  103. opening a file on the handler messes with its environment (like changing
  104. its path, changing shell variables, etc.) while the ACTION_FINDINPUT or
  105. ACTION_FINDOUTPUT packet is still pending.  Furthermore, the process
  106. must run with a higher or same priority than the handler process which
  107. normally runs at priority 5.
  108.  
  109. Since most programs seems to use the dos.library call Open() to open
  110. their files the caveat above is probably not a big problem in practice.
  111.  
  112. If you know of any program that might fall into the category covered by
  113. the caveat, please let me know.  I will try to convince Commodore to
  114. add some features to new versions of the OS that will make it possible
  115. to implement the APipe-Handler in a completely safe way.  This will be
  116. easier if many people use/need the APipe-Handler, so if you like the
  117. concept then give your friends a copy of it!
  118.  
  119. 4) Send bug reports (and praise/support) to
  120.  
  121.         bojsen@moria.dc.dth.dk
  122.  
  123.    Snail mail:
  124.  
  125.         Per Bojsen
  126.         Maglegaards Alle 51 st. th.
  127.         DK-2860 Soeborg
  128.         Denmark
  129.  
  130. 5) Release notes.
  131.  
  132.    37.2  First publically released version.
  133.  
  134.    37.3  Now uses the UserShell when starting programs.
  135.  
  136.    37.4  Fixed bug in handling multiple outstanding read packets at
  137.          EOF.  The bug caused the handler to wait forever.
  138.  
  139.    37.5  Improved cloning of filehandles so that >> redirection and
  140.          mixed reading/writing between parent and child process work
  141.          better.
  142.  
  143. |  37.6  The mountlist entry needed an L: before the definition of the
  144. |        handler.  The device would appear to be mounted but it would
  145. |        not function correctly.
  146. |
  147. |        NOTE: The original author of this program does not appear to be
  148. |        supporting it any longer.  I haven't been able to contact the
  149. |        author through email since the address noted above no longer
  150. |        works.  I am not supporting this program either other than
  151. |        making this minor change to the mountlist since several people
  152. |        have had the same problem.  This pipe is used in fingerd which
  153. |        comes with AmiTCP/IP 3.0b2 so a lot of people have been installing
  154. |        this lately.
  155.  
  156.  
  157.                                     --**--
  158.  
  159. End of README.
  160.